{include file="public/head" /}
<style>input[name='keyword']{width: 210px}</style>
</head>
<body>
{include file="public/top" /}
<div class="am-cf admin-main">
    {include file="public/nav" /}

    <!-- content start -->
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">进行中的报名项目</strong></div>

            </div>

            <div class="am-u-md-12">
                <table class="am-table am-table-bordered am-table-radius am-table-striped">
                    <thead>
                    <tr>
                        <th>项目名称</th>
                        <th>描述</th>
                        <th>报名人数上限</th>
                        <th>实际报名人数</th>
                        <th>报名开始时间</th>
                        <th>报名结束时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="rows" id="vo"}
                    <tr>
                        <td>{$vo.name}</td>
                        <td>{$vo.description}</td>
                        <td>
                            {eq name="$vo.max_student_count" value="0"}
                                不限制
                                {else/}
                                {$vo.max_student_count}
                            {/eq}

                        </td>
                        <td>{$vo.real_student_count}</td>
                        <td>{$vo.begin_time}</td>
                        <td>{$vo.end_time}</td>
                        <td>
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button type="button" class="am-btn am-btn-danger" onclick="signup({$vo.id})">报名</button>
                                </div>
                            </div>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                <div class="pagination" style="float: right">{$page}</div>
            </div>
        </div>
    </div>
</div>
<!-- content end -->
</div>
<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
<script>
    function signup(id) {
        layer.confirm('确认要报名该项目吗?', function (index) {
            $.post("{:url('user/Signup/signupPost')}", {itemId: id}, function (res) {
                if (res.code == 1) {
                    layer.msg(res.msg, {time: 1500, icon: 6});
                    setTimeout(function () {
                        window.location.href = '/user/Signup/index';
                    },1000);
                } else {
                    layer.msg(res.msg, {time: 1500, icon: 5});
                }
            });
        });
    }
</script>
</body>
</html>
